﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using System.Diagnostics;

namespace TrenchcoatRobots.Classes.ComponentClasses {
	/// <summary>
	/// BoxObject draws a box of a color on the screen. Useful for debugging
	/// </summary>
	class BoxObject : Component {
		public Vector2 Size { get; set; }
		public Vector2 Offset { get; set; }
		public Color Color { get; private set; }

		#region Constructors
		/// <summary>
		/// Creates a new BoxObject
		/// </summary>
		/// <param name="parent">The GameObject of which the BoxObject will be placed on</param>
		/// <param name="offset">How the BoxObject should be offset from the GameObject point of origin</param>
		/// <param name="size">The dimensions of the BoxObject</param>
		public BoxObject( ParentMethod parentMethod, Vector2 offset, Vector2 size, Color color )
			: base( parentMethod, "BoxObject", false ) {
			Size = size;
			Offset = Offset;
			Color = color;
		}
		#endregion

		public override void Draw( ref SpriteBatch spriteBatch, ref TrenchcoatRobots.Datatypes.DrawInfo drawinfo ) {
			spriteBatch.Draw(
				drawinfo.blankTexture,
				( Parent().Position + Offset + drawinfo.Camera.Position ) * drawinfo.Camera.Zoom,
				new Rectangle( 0, 0, 1, 1 ),
				Color,
				(float)( Parent().Angle * Math.PI ) * 0.0055555555555556f,
				new Vector2(),
				Size * drawinfo.Camera.Zoom,
				SpriteEffects.None,
				0f
				);
		}
	}
}
